<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const arr = [1, 2, 3, 4]
        // console.log( arr.push(5));
        // console.log(arr);
        //push动态向数组的尾部添加一个单元值--返回是数据的长度
        Array.prototype.myPush = function (fn) {
            if (this.length > 0) this[this.length] = fn
            return this.length
        }
        console.log(arr.myPush(10));
        console.log(arr);
    </script>
</body>

</html>